// api/upload.js
// 当前这个模块：api进行统一管理
import request from '@/utils/request-upload'

// 上传文件
//普通函数形式 
export const uploadFiles = (formData) => request({
  url: '/fileInfo/batchImport',
  method: 'post',
  data: formData,
  headers: {
    'Content-Type': 'multipart/form-data'
  }
});

// 获取所有数据接口
export const reqListAllInfo = () =>request({
  url:'/fileInfo/listAll',
  method: 'get'
});

// 查询分类列表
export function listfileInfo(query) {
  return request({
    url: '/fileInfo/list',
    method: 'get',
    params: query
  })
}

// 增加数据接口
export const addInfo =(uploadInfo)=>request({
  url:'/fileInfo',
  method:'post',
  data:uploadInfo
})

// 更新数据接口
export const updateInfo =(uploadInfo)=>request({
  url:'/fileInfo',
  method:'put',
  data:uploadInfo
})


// 删除数据
export const deleteInfo =(uploadId)=>request({
  url:`/fileInfo/${uploadId}`,
  method:'delete'
})

//分页查询数据
export const reqPageInfo = (pageNum,pageSize)=>request({
  url:`/fileInfo/page/${pageNum}/${pageSize}`,
  method:'get'
});

// 批量删除数据
export const deleteBatchInfo = (uploadIds) => request({
  url: '/fileInfo/batch',
  method: 'delete',
  data: { ids: uploadIds } // 通过请求体传递要删除的id数组
});


// 导出全量信息->Excel文件
export const exportAllInfo = () => {
  return request({
    url: '/fileInfo/allExport',
    method: 'get',
    responseType: 'blob'
  })
};

// 导出选择信息->Excel文件
export const exportBatchInfo = (exportIds) => request({
  url: '/fileInfo/batchExport',
  method: 'get',
  params: {
    ids: exportIds,
  },
  responseType: 'blob',
});




